Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDesigner form automatic resizing
Forum Updated to NodeBB v4.3 + New Features

QDesigner form automatic resizing

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jcga
    wrote on last edited by
    #1

    I'm affraid the question has been asked before but I couldn't find a satisfying answer neither on the documentation nor in the FAQ's and forum.
    The question is: I want to create a QWidget (or QDialog) with QDesigner. It will simply contain a QTableWidget and a "Close" QPushButton. But I want the TableWidget to resize when the QWidget is resized, but not the PushButton. Seems easy... Any help is appreciated.

    JC

    kshegunovK ? 2 Replies Last reply
    0
    • J jcga

      I'm affraid the question has been asked before but I couldn't find a satisfying answer neither on the documentation nor in the FAQ's and forum.
      The question is: I want to create a QWidget (or QDialog) with QDesigner. It will simply contain a QTableWidget and a "Close" QPushButton. But I want the TableWidget to resize when the QWidget is resized, but not the PushButton. Seems easy... Any help is appreciated.

      JC

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #2

      @jcga
      Hi,
      If we are talking vertical resizing, the button will not change size anyway; its default vertical size policy is QSizePolicy::Fixed. If we are talking horizontal, then again, the button's default horizontal size policy is QSizePolicy::Minimum, so it'll occupy the minimum amount of space when put side to side with an expanding widget (such as QTableWidget).
      So the answer seems to be:
      Add both your widgets to a layout and you should be good to go.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      J 1 Reply Last reply
      0
      • kshegunovK kshegunov

        @jcga
        Hi,
        If we are talking vertical resizing, the button will not change size anyway; its default vertical size policy is QSizePolicy::Fixed. If we are talking horizontal, then again, the button's default horizontal size policy is QSizePolicy::Minimum, so it'll occupy the minimum amount of space when put side to side with an expanding widget (such as QTableWidget).
        So the answer seems to be:
        Add both your widgets to a layout and you should be good to go.

        Kind regards.

        J Offline
        J Offline
        jcga
        wrote on last edited by
        #3

        @kshegunov

        Hi, thanks for aswering. I tried to add a vertical layout, put the QTableWidget on the top and the button on the bottom, but when I resize the window, the TableWidget keeps its original size, it does seem to adapt to the new size. I certainly missed something to do to instruct the layout to resize with the parent widget.

        kshegunovK 1 Reply Last reply
        0
        • J jcga

          @kshegunov

          Hi, thanks for aswering. I tried to add a vertical layout, put the QTableWidget on the top and the button on the bottom, but when I resize the window, the TableWidget keeps its original size, it does seem to adapt to the new size. I certainly missed something to do to instruct the layout to resize with the parent widget.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @jcga
          Hi.
          I suggest looking up this thread.

          Kind regards.

          Read and abide by the Qt Code of Conduct

          J 1 Reply Last reply
          0
          • J jcga

            I'm affraid the question has been asked before but I couldn't find a satisfying answer neither on the documentation nor in the FAQ's and forum.
            The question is: I want to create a QWidget (or QDialog) with QDesigner. It will simply contain a QTableWidget and a "Close" QPushButton. But I want the TableWidget to resize when the QWidget is resized, but not the PushButton. Seems easy... Any help is appreciated.

            JC

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by A Former User
            #5

            @jcga Hi! Please post a drawing of what your form shall look like. I'm sure we can find a solution quickly.

            Edit: To post an image, upload it to, e.g., https://postimage.org, and then embed it here with ![alternate text](image url)

            1 Reply Last reply
            0
            • kshegunovK kshegunov

              @jcga
              Hi.
              I suggest looking up this thread.

              Kind regards.

              J Offline
              J Offline
              jcga
              wrote on last edited by jcga
              #6

              @kshegunov @Wieland
              Thanks, I looked up the suggested thread and it solved the problem.
              Thnaks Wieland for your answer.

              Best regards,

              jclaude

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved